package com.example.demo.demos.web;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class Factory {

    public static Map<String, AbstractHandler> strategyMap = new HashMap<>();

    public static AbstractHandler getInvokeStrategy(String str) {
        return strategyMap.get(str);
    }

    public static void register(String str, AbstractHandler handler) {
        if (StringUtils.isBlank(str)) {
            return;
        }
        if (Objects.isNull(handler)) {
            return;
        }
        strategyMap.put(str, handler);
    }
}
